package com.example.rabbitmqstudy.service;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import com.example.rabbitmqstudy.constant.RabbitConstant;

/**
 * @author admin
 * @date 2021/07/14 15:27
 */
@Component
public class RabbitPublishSubscribeConsumer {

    @RabbitHandler
    @RabbitListener(queues = RabbitConstant.PUBLISH_SUBSCRIBE_FIRST_QUEUE_NAME)
    public void pubsubQueueFirst(String context){
        System.out.println("rabbit pubsub queue first receiver:" + context);
    }

    @RabbitHandler
    @RabbitListener(queues = RabbitConstant.PUBLISH_SUBSCRIBE_SECOND_QUEUE_NAME)
    public void pubsubQueueSecond(String context){
        System.out.println("rabbit pubsub queue second reveiver:" + context);
    }
}
